package main;

import java.rmi.RemoteException;

import comunicacao.GestorZooKeeper;
import entities.ConfigInfo;
import entities.ServerInfo;

/**
 * Thread de execucao de uma base de dados
 * 
 * @author Leonardo Lino Nº45340
 * @author Diogo Pires Nº40351
 */
public class DBThread implements Runnable {

	ServerInfo leaderInfo;
	GestorZooKeeper zKeeper;
	Object signal;
	ConfigInfo config;
	DBmanager database;
	String managerData = null;

	public DBThread(ConfigInfo config, Object signal, GestorZooKeeper zKeeper,
			ServerInfo leaderInfo, String managerData) {
		this.config = config;
		this.signal = signal;
		this.zKeeper = zKeeper;
		this.leaderInfo = leaderInfo;
		this.managerData= managerData;
	}

	@Override
	public void run() {
		try {
			database = new DBmanager(config, signal, zKeeper, leaderInfo, managerData);
		} catch (RemoteException e) {
			System.out.println("DB Remote Exception ocurred");
		}
	}

}
